<!--https://www.cnblogs.com/lyt0207/p/12730308.html-->
<template>
  <el-container class="container">
    <el-header class="header">
      <el-row>
        <el-col :span="16" class="headerlogo">
          <div class="grid-content bg-purple">
            <img style="width:400px;height: 30px" alt="无法显示图片" src="../../assets/logo.png"/>
          </div>
        </el-col>
        <el-col :span="8" class="rightsection">
          <div class="grid-content bg-purple-light">
            <span class="el-dropdown-link userinfo-inner">欢迎您</span>
            <span class="userinfo-inner" @click="signout">退出</span>
          </div>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <el-aside class="aside">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>导航一</span>
            </template>
            <el-menu-item-group>
              <template slot="title">分组一</template>
              <el-menu-item index="1-1">选项1</el-menu-item>
              <el-menu-item index="1-2">选项2</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="分组2">
              <el-menu-item index="1-3">选项3</el-menu-item>
            </el-menu-item-group>
            <el-submenu index="1-4">
              <template slot="title">选项</template>
              <el-menu-item index="1-4-1">选项1</el-menu-item>
            </el-submenu>
          </el-submenu>
          <el-menu-item index="2">
            <i class="el-icon-menu"></i>
            <span slot="title">导航二</span>
          </el-menu-item>
          <el-menu-item index="3" disabled>
            <i class="el-icon-document"></i>
            <span slot="title">导航三</span>
          </el-menu-item>
          <el-menu-item index="4">
            <i class="el-icon-setting"></i>
            <span slot="title">导航四</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main class="main">
        <el-steps :active="active" finish-status="success">
          <el-step title="第一步"/>
          <el-step title="第二步"/>
          <el-step title="第三步"/>
          <el-step title="第四步"/>
        </el-steps>

        <el-form ref="dataForm"
                 :model="ef"
                 :rules="formRules"
                 label-position="left"
                 label-width="100px"
                 style="width:400px"
                 margin-left="50px">

          <div v-show="active == 1">
            <el-form-item label="设备名称" prop="name">
              <el-input v-model="temp.name" placeholder="输入"/>
            </el-form-item>
          </div>

        </el-form>

        <el-button v-if="active > 1" style="margin-top:12px" @click="pre">上一步</el-button>
        <el-button v-if="active < 4" style="margin-top:12px" @click="next">下一步</el-button>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'index',
  data () {
    return {
      active: 1,
      temp: {
        name: '1'
      }
    }
  },
  methods: {
    next () {
      if (this.active++ > 3) {
        this.active = 1
      }
    },
    pre () {
      if (this.active-- < 2) {
        this.active = 1
      }
    },
    signout () {
      this.$confirm('退出登录,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$router.push({path: '/'})
      })
    }
  }
}
</script>

<style scoped>
.container {
  height: 100vh;
  font-size: 15px;
}

.header {
  background: #212121;
  color: #fff;
}

.aside {
  background: #3a3a3a;
  color: #fff;
}

.main {
  color: #212121;
}

.headerlogo {
  line-height: 60px;
  margin-top: 10px;
}

.rightsection {
  line-height: 60px;
  text-align: center;
}
</style>
